namespace classifier_test
{

class weight_by_accuracy_ensemble_classifier : public stream_classifier
{
public:
	weight_by_accuracy_ensemble_classifier();
	weight_by_accuracy_ensemble_classifier(const weight_by_accuracy_ensemble_classifier& Val);
	smart_ptr<stream_classifier> clone() const;
	int get_chunk_size() const;
	void set_chunk_size(int SetChunkSize);
	int get_classifier_count() const;
	void set_classifier_count(int SetClassifierCount);

	void build(subarray<const stream_record* const> Data);
	void train(const stream_record& LabeledRecord);
	discr_value classify(const stream_record& Record) const;
	void estimate(const stream_record& Record, array<double>& Probs) const;

protected:
	void initialize_options(command_line_options& Options) const;
	void apply_arguments(const command_line_arguments& Args);

private:
	int ChunkSize;
	int ClassifierCount;

	vector<smart_ptr<stream_record> > TrData;
	array<double> Freqs;
	map<classifier*, smart_ptr<classifier> > Classifiers;
	vector<pair<double, classifier*> > List;

	void compute_freqs();
	double error_rate_threshold_of() const;
	double error_rate_of(classifier* Classifier) const;
	void weigh_classifiers();
};

}

